package com.zzk.lanouhn.myapplication1.adapters;

import android.content.Context;
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zzk.lanouhn.myapplication1.R;
import com.zzk.lanouhn.myapplication1.modles.FindDetailsModle;

/**
 * 无用的适配器 就是不删
 * Created by lanouhn on 16/9/7.
 */
public class FindDetailsCaiDanDayAdapter extends RecyclerView.Adapter<FindDetailsCaiDanDayAdapter.MyCaidanHolder> {

    private Context context;
    private FindDetailsModle detailsModle;
    private FindDetailsCaiDanWeizhiAdapter weizhiAdapter;

    public FindDetailsCaiDanDayAdapter(Context context, FindDetailsModle detailsModle) {
        this.context = context;
        this.detailsModle = detailsModle;
    }

    @Override
    public MyCaidanHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_find_details_caidan_day, null);
        MyCaidanHolder holder = new MyCaidanHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MyCaidanHolder holder, int position) {

        holder.day.setText("DAY"+detailsModle.getTrip_days().get(position).getDay());

        RecyclerView recyclerView = new RecyclerView(context);
        weizhiAdapter = new FindDetailsCaiDanWeizhiAdapter(context, detailsModle.getTrip_days().get(position));
        recyclerView.setAdapter(weizhiAdapter);

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        recyclerView.setLayoutManager(linearLayoutManager);
        holder.ll.addView(recyclerView);

    }

    @Override
    public int getItemCount() {
        return detailsModle.getTrip_days().size();
    }


    public class MyCaidanHolder extends RecyclerView.ViewHolder {
        private TextView day;
        private LinearLayout ll;

        public MyCaidanHolder(View itemView) {
            super(itemView);
            day = (TextView) itemView.findViewById(R.id.item_find_details_caidan_day);
            ll = (LinearLayout) itemView.findViewById(R.id.item_find_details_caidan_ll);

        }
    }
}
